From 9ee16ea89783ee906ff5b49f6930ff36e167030f Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Tue, 11 Jul 2006 22:54:28 +0000 Subject: [PATCH] (sit_for): Signal error if TIMEOUT is not a number in case arg comes directly from a Lisp variable. --- src/dispnew.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/dispnew.c b/src/dispnew.c index 3519e2d64fe..018717e591f 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6519,17 +6519,21 @@ sit_for (timeout, reading, do_display) if (do_display >= 2) redisplay_preserve_echo_area (2); - if (FLOATP (timeout)) + if (INTEGERP (timeout)) { - double seconds = XFLOAT_DATA (timeout); + sec = XFASTINT (timeout); + usec = 0; + } + else if (FLOATP (timeout)) + { + double seconds; + + seconds = XFLOAT_DATA (timeout); sec = (int) seconds; usec = (int) ((seconds - sec) * 1000000); } else - { - sec = XFASTINT (timeout); - usec = 0; - } + wrong_type_argument (Qnumberp, timeout); if (sec == 0 && usec == 0) return Qt; -- 2.30.2